
// main
import HomeView from "@/views/Home/index.vue";
import CategoryView from "@/views/Category/index.vue";
import SearchView from "@/views/Search/index.vue";
import ListView from "@/views/List/index.vue";
import CarView from "@/views/Car/index.vue";
import MineView from "@/views/Mine/index.vue";
import LoginView from "@/views/Login/index.vue";
import RegisterView from "@/views/Register/index.vue";
import NotFoundView from "@/views/NotFound/index.vue";

// footer
import CommonFooterVue from "@/layout/CommonFooter.vue";

import type { RouteLocationNormalizedLoaded } from "vue-router"
// import { useRoute } from "vue-router";


export default [
  {
    path: '/',
    redirect: "/home"
  },
  {
    path: '/home',
    name: 'home',
    // component: HomeView
    components: {
      default: HomeView,
      footer: CommonFooterVue
    }
  },
  {
    path: '/category',
    name: 'category',
    components: {
      default: CategoryView,
      footer: CommonFooterVue
    }
  },
  {
    path: '/search',
    name: 'search',
    components: {
      default: SearchView,
      footer: CommonFooterVue
    }
  },
  {
    path: '/list',
    name: 'list',
    components: {
      default: ListView,
      footer: CommonFooterVue
    }
  },
  {
    path: '/car',
    name: 'car',
    components: {
      default: CarView,
      footer: CommonFooterVue
    }
  },
  {
    path: '/mine',
    name: 'mine',
    meta: {
      Auth: true,  // 是否需要登录
    },
    component: MineView
  },
  {
    path: '/login',
    name: 'login',
    component: LoginView,
  },
  {
    path: '/register',
    name: 'register',
    component: RegisterView,
  },
  {
    path: '/404',
    name: 'notFound',
    component: NotFoundView,
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: (from: RouteLocationNormalizedLoaded) => {
      return { path: "/404", query: { wd: from.fullPath } }
    }
  }
]